package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.ApiU_discover;
import cn.com.util.PageInfo;

//DAO
public interface U_discoverMapperBase {

	// 根据id查看
	@Select("SELECT * FROM U_DISCOVER  WHERE ID = #{id}")
	public ApiU_discover findU_discoverById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_discover")
	public List<ApiU_discover> findU_discovers();

	// 根据条件查看数据集
	public List<ApiU_discover> findU_discoversByMap(@Param("map") Map map);

	// 添加
	// @Insert("INSERT INTO U_DISCOVER (ID, HEAD_IMG, VEDIO, TITLE, BEGIN_TIME,
	// END_TIME, ADDRESS, PEOPLE_LIMIT, DESCRIPTION, ACTIVITY_TYPE, LONGITUDE,
	// LATITUDE, IS_VERIFY, USER_ID, ADD_TIME, VERIFY_TIME, VERIFY_BY,
	// AVERAGE_PRICE, IS_REFUND, IS_ADD, TYPE) VALUES (SEQT_DISCOVER_ID.nextVal,
	// #{head_img}, #{vedio}, #{title}, #{begin_time}, #{end_time}, #{address},
	// #{people_limit}, #{description}, #{activity_type}, #{longitude},
	// #{latitude}, #{is_verify}, #{user_id}, #{add_time}, #{verify_time},
	// #{verify_by}, #{average_price}, #{is_refund}, #{is_add}, #{type})")
	// @Options(useGeneratedKeys = false, keyProperty = "id")
	public int insertU_discover(ApiU_discover u_discover);

	// 修改
	@Update("UPDATE U_DISCOVER SET HEAD_IMG = #{head_img}, VEDIO = #{vedio}, TITLE = #{title}, BEGIN_TIME = #{begin_time}, END_TIME = #{end_time}, ADDRESS = #{address}, PEOPLE_LIMIT = #{people_limit}, DESCRIPTION = #{description}, ACTIVITY_TYPE = #{activity_type}, LONGITUDE = #{longitude}, LATITUDE = #{latitude}, IS_VERIFY = #{is_verify}, USER_ID = #{user_id}, ADD_TIME = STR_TO_DATE(#{add_time,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss'), VERIFY_TIME = STR_TO_DATE(#{verify_time,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss'), VERIFY_BY = #{verify_by}, AVERAGE_PRICE = #{average_price}, IS_REFUND = #{is_refund}, IS_ADD = #{is_add}, TYPE = #{type}, share_count = #{share_count} WHERE ID = #{id}")
	public int updateU_discover(ApiU_discover u_discover);

	// 删除
	@Delete("DELETE FROM U_DISCOVER  WHERE ID = #{id}")
	public int deleteU_discover(Integer id);

	// Foreign keys revelant

	// region Indexs revelant
	public List<Map<String, Object>> searchDiscoverPage(@Param("map") Map<String, Object> conditions,
			@Param("page") PageInfo pageInfo);
}
